<html>
    <head>
        <script>
       function log(msg)
       {
           document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
       }

       function test()
       {
           if (window.testRunner) {
               testRunner.waitUntilDone();
               testRunner.dumpAsText();
               setTimeout(autoscrollTestPart1, 0);
           }
       }

       function autoscrollTestPart1()
       {
           var iframe = document.getElementById('NoScrolliFrame');
           var iframeDocument = iframe.contentDocument;
           var textInIframe = iframeDocument.getElementById('textInFrame');
           if (window.eventSender) {
               var x = iframe.offsetLeft + textInIframe.offsetLeft + 7;
               var y = iframe.offsetTop + textInIframe.offsetTop + 7;
               eventSender.dragMode = false;
               eventSender.mouseMoveTo(x, y);
               eventSender.mouseDown();
               eventSender.mouseMoveTo(x + 220, y + 220);
           }
           setTimeout(autoscrollTestPart2, 100);
       }

       function autoscrollTestPart2()
       {
           if (window.eventSender)
               eventSender.mouseUp();
           var sd = document.getElementById('scrollableDiv');
           if (sd.scrollLeft != 0)
               log("PASSED : the autoscroll has worked !");
           else
               log("FAILED : the autoscroll has not worked :-(");
           
           if (window.testRunner)
               testRunner.notifyDone();
       }       
        </script>
    </head>
<body onload="test()">
       
   <div id="scrollableDiv" style="height: 100px; overflow-x: auto; overflow-y: auto; width: 100px">
       <div style=" height: 1000px; width: 1000px">
           <iframe id="NoScrolliFrame" src="resources/big-page-with-overflow-hidden.html" style="height: 1000px; width: 1000px"></iframe>
       </div>
   </div>

    <div id="console">
       rdar://problem/6166435  Inspector doesn't auto scroll when selecting text (20451) <br>
       To do the test manually you have to try triggering the autoscroll by starting the dragging from within the blue iframe. If the autoscroll occurs the text has passed, if the autoscroll isn't working, the test has failed<br>
       nb: Knowing that the iframe document has an overflow: hidden on its body but the whole iframe is embedded in a scrollable div, the scrollable div has to be able to trigger the autoscroll<br>
       Though you should be able to write some long text in the input and to trigger the autoscroll within the input.<br>
   </div>
    
</body>
</html>

